/**
 * auther:lifuyuan
 * date:18-05-08
 * time:14:16
 *  
*/


/**
 * 获取当前时间 格式YYYYMMddHHmmss
 * @returns {string}
*/
exports.getNowFormatTime1 = function(){
    var date = new Date(),
        month = date.getMonth(),
        strDate = date.getDate(),
        hour = date.getHours(),
        minute = date.getMinutes(),
        second = date.getSeconds(),
        tempArray = new Array(month,strDate,hour,minute,second);
        for(var key in tempArray){
            if(key >= 2){
                if(tempArray[key] >=0 && tempArray[key] <= 9){
                    tempArray[key] = '0' + tempArray[key];
                }
            }else{
                if(tempArray[key] >= 1 && tempArray[key] <= 9){
                    tempArray[key] = '0' + tempArray[key];
                }
            }
        }
        var currentdate  =date.getFullYear() + tempArray[0] + tempArray[1] + tempArray[2] + tempArray[3] + tempArray[4];
        return currentdate;
}
/**
 * 获取当前时间，格式YYYY-MM-dd HH:mm:ss
 * @return {string}
 * 
*/
exports.getNowFormatTime = function(){
    var date = new Date(),
    seperator1 = "-",
    seperator2 = ":",
    mongth = date.getMonth() + 1;
    var strDate = date.getDate(),
    hour = date.getHours(),
    minute = date.getMinutes(),
    second = date.getSeconds();
    for(var key in tempArray){
        if(key >= 2){
            if(tempArray[key] >= 0 && tempArray[key]<=9){
                tempArray[key] = '0' + tempArray[key];
            }
        }else{
            if(tempArray[key]>=1 && tempArray[key]<=9){
                tempArray[key] = '0' + tempArray[key];
            }
        }
    }
    var currentdate = date.getFullYear() + seperator1 + tempArray[0] + seperator1 + tempArray[1] + ' ' + tempArray[2] + seperator2 + tempArray[3] + seperator2 + tempArray[4];
    return currentdate;
}
/**
 * 获取当前日期格式YYYY-MM-dd
 * @return {number}
 * 
*/
exports.getCurrentDate = function(){
    var date = new Date(),
        seperator1 = '-',
        seperator2 = ":",
        month  = date.getMonth() + 1;
        var strDate = date.getDate();
        var tempArray = new Array(month,strDate);
        for(var key in temArray){
            if(tempArray[key]>=1 && tempArray[key]<=9){
                tempArray[key] = '0' + tempArray[key];
            }
        }
        var currentdate = date.getFullYear() + seperator1 + tempArray[0] + seperator1 + tempArray[1];
}

/**
 * 获取当前日期   格式：HH:mm:ss
 * @returns {number}
 */
exports.getFormatTime = function() {
    var date = new Date();  seperator2 = ":"; 
    var hour = date.getHours(); minute = date.getMinutes(); second = date.getSeconds();
    var tempArray = new Array(hour, minute, second);
    for(var key in tempArray) {
       // if tempArray.hasOwnProperty(key)) {};
        if(key >= 0){
            if(tempArray[key] >=0 && tempArray[key] <= 9)
                tempArray[key] = '0' + tempArray[key];
        } else {
            if(tempArray[key] >= 1 && tempArray[key] <= 9)
                tempArray[key] = '0' + tempArray[key];
        }
    }
    var currentdate =  tempArray[0] + seperator2 + tempArray[1] + seperator2 + tempArray[2];
    return currentdate;
}